home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
32
/
anagram.zip
/
ANA.DOC
< prev
next >
Wrap
Text File
|
1986-05-26
|
946b
|
18 lines
The ana program will ask you to type in a beginning word. It will then
begin generating all permutations of the letters. the way I did it was to
write a recursive routine to rotate the letters. This generates the
permutations in an inverted tree. Example;
abc (Beginning word)
|------------|------------|
abc bca cab
/ \ / \ / \
abc acb bca bac cab cba
You will notice that the left side of every tree is a duplicate of the
root. I had to use a first time switch to prune out the duplicates. You can
send the output to a file by typing 'ana > file.txt' from the dos prompt.
Note: if you do this the beginning prompt will be written to the file also
and will not be displayed on the screen. The program will still be waiting
for input, so just type in your beginning word.